/*     */ package dm.jdbc.rsCache;
/*     */ 
/*     */ import dm.jdbc.driver.DmdbPreparedStatement_bs;
/*     */ import dm.sql.DmdbIntervalDT;
/*     */ import dm.sql.DmdbIntervalYM;
/*     */ import java.math.BigDecimal;
/*     */ import java.sql.Date;
/*     */ import java.sql.Time;
/*     */ 
/*     */ public class DmdbResultSetKey
/*     */ {
/*  12 */   String m_guid = null;
/*  13 */   String m_curSch = null;
/*  14 */   String m_sql = null;
/*     */   
/*     */   public final int m_paramCount;
/*  17 */   public Object[] m_paramObjects = null;
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*  26 */   private boolean m_codeCalced = false;
/*  27 */   private int m_codeVal = 0;
/*     */   
/*     */   public DmdbResultSetKey(String guid, String curSch, String sql, dm.jdbc.driver.DmdbStatement_bs stmt)
/*     */   {
/*  31 */     this.m_guid = guid;
/*  32 */     this.m_curSch = curSch;
/*  33 */     this.m_sql = sql;
/*     */     
/*  35 */     if (((stmt instanceof DmdbPreparedStatement_bs)) || 
/*  36 */       ((stmt instanceof dm.jdbc.driver.DmdbCallableStatement_bs))) {
/*  37 */       ((DmdbPreparedStatement_bs)stmt).copyParamValueBound(this);
/*  38 */       int parmCount = ((DmdbPreparedStatement_bs)stmt).getParamCount();
/*  39 */       int outParmCount = ((DmdbPreparedStatement_bs)stmt)
/*  40 */         .getOutParamCount();
/*  41 */       if (parmCount > outParmCount) {
/*  42 */         this.m_paramCount = parmCount;
/*     */       } else
/*  44 */         this.m_paramCount = 0;
/*     */     } else {
/*  46 */       this.m_paramCount = 0;
/*     */     }
/*     */   }
/*     */   
/*  50 */   public int hashCode() { if (this.m_codeCalced) {
/*  51 */       return this.m_codeVal;
/*     */     }
/*  53 */     if ((this.m_guid == null) || (this.m_curSch == null) || (this.m_sql == null)) {
/*  54 */       this.m_codeVal = 0;
/*  55 */       this.m_codeCalced = true;
/*     */       
/*  57 */       return this.m_codeVal;
/*     */     }
/*     */     
/*  60 */     this.m_codeVal = (this.m_guid.hashCode() ^ this.m_curSch.hashCode() ^ this.m_sql.hashCode());
/*  61 */     for (int i = 0; i < this.m_paramCount; i++) {
/*  62 */       if ((this.m_paramObjects[i] instanceof Boolean)) {
/*  63 */         this.m_codeVal += ((Boolean)this.m_paramObjects[i]).hashCode();
/*  64 */       } else if ((this.m_paramObjects[i] instanceof Byte)) {
/*  65 */         this.m_codeVal += ((Byte)this.m_paramObjects[i]).hashCode();
/*  66 */       } else if ((this.m_paramObjects[i] instanceof Short)) {
/*  67 */         this.m_codeVal += ((Short)this.m_paramObjects[i]).hashCode();
/*  68 */       } else if ((this.m_paramObjects[i] instanceof Integer)) {
/*  69 */         this.m_codeVal += ((Integer)this.m_paramObjects[i]).hashCode();
/*  70 */       } else if ((this.m_paramObjects[i] instanceof Long)) {
/*  71 */         this.m_codeVal += ((Long)this.m_paramObjects[i]).hashCode();
/*  72 */       } else if ((this.m_paramObjects[i] instanceof Float)) {
/*  73 */         this.m_codeVal += ((Float)this.m_paramObjects[i]).hashCode();
/*  74 */       } else if ((this.m_paramObjects[i] instanceof Double)) {
/*  75 */         this.m_codeVal += ((Double)this.m_paramObjects[i]).hashCode();
/*  76 */       } else if ((this.m_paramObjects[i] instanceof BigDecimal)) {
/*  77 */         this.m_codeVal += ((BigDecimal)this.m_paramObjects[i]).hashCode();
/*  78 */       } else if ((this.m_paramObjects[i] instanceof Date)) {
/*  79 */         this.m_codeVal += ((Date)this.m_paramObjects[i]).hashCode();
/*  80 */       } else if ((this.m_paramObjects[i] instanceof java.sql.Timestamp))
/*     */       {
/*  82 */         this.m_codeVal = (this.m_codeVal + ((java.sql.Timestamp)this.m_paramObjects[i]).hashCode());
/*  83 */       } else if ((this.m_paramObjects[i] instanceof Time)) {
/*  84 */         this.m_codeVal += ((Time)this.m_paramObjects[i]).hashCode();
/*  85 */       } else if ((this.m_paramObjects[i] instanceof dm.sql.DmdbTime)) {
/*  86 */         this.m_codeVal += ((dm.sql.DmdbTime)this.m_paramObjects[i]).hashCode();
/*  87 */       } else if ((this.m_paramObjects[i] instanceof DmdbIntervalDT)) {
/*  88 */         this.m_codeVal += ((DmdbIntervalDT)this.m_paramObjects[i]).hashCode();
/*  89 */       } else if ((this.m_paramObjects[i] instanceof DmdbIntervalYM)) {
/*  90 */         this.m_codeVal += ((DmdbIntervalYM)this.m_paramObjects[i]).hashCode();
/*  91 */       } else if ((this.m_paramObjects[i] instanceof String)) {
/*  92 */         this.m_codeVal += ((String)this.m_paramObjects[i]).hashCode();
/*  93 */       } else if ((this.m_paramObjects[i] instanceof byte[])) {
/*  94 */         this.m_codeVal += ((byte[])this.m_paramObjects[i]).hashCode();
/*     */       }
/*     */     }
/*     */     
/*  98 */     this.m_codeCalced = true;
/*     */     
/* 100 */     return this.m_codeVal;
/*     */   }
/*     */   
/*     */   public boolean equals(Object o) {
/* 104 */     if (o == null) {
/* 105 */       return false;
/*     */     }
/* 107 */     if (!(o instanceof DmdbResultSetKey)) {
/* 108 */       return false;
/*     */     }
/* 110 */     DmdbResultSetKey rsKey = (DmdbResultSetKey)o;
/* 111 */     if ((!this.m_guid.equals(rsKey.m_guid)) || (!this.m_curSch.equals(rsKey.m_curSch)) || 
/* 112 */       (!this.m_sql.equals(rsKey.m_sql)) || 
/* 113 */       (this.m_paramCount != rsKey.m_paramCount)) {
/* 114 */       return false;
/*     */     }
/* 116 */     for (int i = 0; i < this.m_paramCount; i++) {
/* 117 */       if ((this.m_paramObjects[i] == null) && (rsKey.m_paramObjects[i] != null)) {
/* 118 */         return false;
/*     */       }
/* 120 */       if (this.m_paramObjects[i] != null) {
/* 121 */         if ((this.m_paramObjects[i] instanceof byte[])) {
/* 122 */           if ((rsKey.m_paramObjects[i] == null) || 
/* 123 */             (!(rsKey.m_paramObjects[i] instanceof byte[])) || 
/* 124 */             (((byte[])rsKey.m_paramObjects[i]).length != ((byte[])rsKey.m_paramObjects[i]).length)) {
/* 125 */             return false;
/*     */           }
/* 127 */           int len = ((byte[])rsKey.m_paramObjects[i]).length;
/* 128 */           for (int j = 0; j < len; j++) {
/* 129 */             if (((byte[])this.m_paramObjects[i])[j] != ((byte[])rsKey.m_paramObjects[i])[j])
/* 130 */               return false;
/*     */           }
/* 132 */         } else if (!this.m_paramObjects[i].equals(rsKey.m_paramObjects[i])) {
/* 133 */           return false;
/*     */         }
/*     */       }
/*     */     }
/* 137 */     return true;
/*     */   }
/*     */ }


/* Location:              D:\Program Files\DBMS_20150813\jdbc\Dm7JdbcDriver17.jar!\dm\jdbc\rsCache\DmdbResultSetKey.class
 * Java compiler version: 2 (46.0)
 * JD-Core Version:       0.7.1
 */